namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using Engine.Report;

    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Saf.Tests;
    using Entities;

    using SharePoint.Wss.Security;

    using Utils;

    using Wss.Security;


    /// <summary>
    /// This test was originally generated but has now been tested and verfiied by MJ
    /// </summary>
    [TestClass]
    public class CreateUserTest
    {

        [TestMethod]
        public void CreateUser_Test()
        {
            WSSTestAssistant<CreateUser, UserInfo> createuser =
                    new WSSTestAssistant<CreateUser, UserInfo>(TestEnvironment.PublishingSite, 
                        "CreateUserTestWeb", "BLANKINTERNET#0");

            using (createuser)
            {
                ADHelper.DeleteUserAccount("UnitTester1");
                ADHelper.CreateUserAccount("UnitTester1", "abcde_1234", "Unit Tester", false);

                createuser.FirstEntity.LoginName = @"local\UnitTester1";
                createuser.FirstEntity.Name = "test user";
                createuser.FirstEntity.Notes = "new test user";
                createuser.FirstEntity.MakeAdmin = true;

                MacroReport doReport = createuser.DoMacro();

                Assert.IsNotNull(SecurityHelper.GetUserAsMember(createuser.TestWeb, false, createuser.FirstEntity.LoginName));

                //MacroReport undoReport = createuser.UndoMacro();

                //Assert.IsNull(SecurityHelper.GetUserAsMember(createuser.TestWeb, false, createuser.FirstEntity.LoginName));
            }
        }

    }
}
